home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / MCLBK100.ZIP / MEMCALL.H < prev    next >
C/C++ Source or Header  |  1993-09-06  |  10KB  |  226 lines

  1. // TMemberCallback class
  2. //
  3. // Description:    This class provides the necessary functionality
  4. //                requires by a C++ application to use a member function
  5. //                as a Windows CALLBACK function.
  6. //
  7. // Author:        Weldon W. (Trey) Nash, III
  8. //
  9.  
  10. // To inhibit multiple imclusion within compilation.
  11. #ifndef __MEMDLL_H
  12.    #define __MEMDLL_H
  13.  
  14. #include <windows.h>
  15. #include <ddeml.h>
  16. #include <stddef.h>
  17. #include <_defs.h>
  18.  
  19. // This is an OWL thing.  It is only used to provide the CLASSDEF macro in
  20. // order to facilitate automatic typedef creation.  The typedefs are used 
  21. // in different ways to address objects as explained in the documentation.
  22. // non-OWL users may need to remove this and supply the typedefs themselves.
  23. #include <owldefs.h>
  24.  
  25. // These are OWL specific macros.  They basically provide a means to
  26. // address objects by creating typedefs for the classes.  The macro
  27. // is contained in owldefs.h.
  28. _CLASSDEF(CODESTUB)
  29. _CLASSDEF(CODESTUBNODE)
  30. _CLASSDEF(TMEMBERCALLBACK)
  31.  
  32. // For the sake of forward referencing.
  33. class _EXPORT TMemberCallback;
  34.  
  35. // This union is used to contain a pointer to the member function
  36. // which is to be called by Windows.  It is contained in this union in
  37. // order to facilitate type casting.
  38. union CALLBACKPROC
  39. {
  40.     BOOL     CALLBACK  (TMemberCallback::*lpfnAbortProc)
  41.                         (HDC, int);
  42.     LRESULT  CALLBACK  (TMemberCallback::*lpfnCallWndProc)
  43.                         (int, WPARAM, LPARAM);
  44.     LRESULT  CALLBACK  (TMemberCallback::*lpfnCBTProc)
  45.                         (int, WPARAM, LPARAM);
  46.     HDDEDATA CALLBACK  (TMemberCallback::*lpfnDdeCallback)
  47.                         (UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD);
  48.     LRESULT  CALLBACK  (TMemberCallback::*lpfnDebugProc)
  49.                         (int, WPARAM, LPARAM);
  50.     BOOL     CALLBACK  (TMemberCallback::*lpfnDialogProc)
  51.                         (HWND, UINT, WPARAM, LPARAM);
  52.     LRESULT  CALLBACK  (TMemberCallback::*lpfnDriverProc)
  53.                         (DWORD, HDRVR, UINT, LPARAM, LPARAM);
  54.     BOOL     CALLBACK  (TMemberCallback::*lpfnEnumChildProc)
  55.                         (HWND, LPARAM);
  56.     int      CALLBACK  (TMemberCallback::*lpfnEnumFontFamProc)
  57.                         (LOGFONT FAR*, TEXTMETRIC FAR*, int, LPARAM);
  58.     int      CALLBACK  (TMemberCallback::*lpfnEnumFontsProc)
  59.                         (LOGFONT FAR*, NEWTEXTMETRIC FAR*, int, LPARAM);
  60.     int      CALLBACK  (TMemberCallback::*lpfnEnumMetaFileProc)
  61.                         (HDC, HANDLETABLE FAR*, METARECORD FAR*, int, LPARAM);
  62.     int      CALLBACK  (TMemberCallback::*lpfnEnumObjectsProc)
  63.                         (void FAR*, LPARAM);
  64.     BOOL     CALLBACK  (TMemberCallback::*lpfnEnumPropFixedProc)
  65.                         (HWND, LPCSTR, HANDLE);
  66.     BOOL     CALLBACK  (TMemberCallback::*lpfnEnumPropMovableProc)
  67.                         (HWND, LPCSTR, HANDLE);
  68.     BOOL     CALLBACK  (TMemberCallback::*lpfnEnumTaskWndProc)
  69.                         (HWND, LPARAM);
  70.     BOOL     CALLBACK  (TMemberCallback::*lpfnEnumWindowsProc)
  71.                         (HWND, LPARAM);
  72.     LRESULT  CALLBACK  (TMemberCallback::*lpfnGetMsgProc)
  73.                         (int, WPARAM, LPARAM);
  74.     BOOL     CALLBACK  (TMemberCallback::*lpfnGrayStringProc)
  75.                         (HDC, LPARAM, int);
  76.     LRESULT  CALLBACK  (TMemberCallback::*lpfnHardwareProc)
  77.                         (int, WPARAM, LPARAM);
  78.     LRESULT  CALLBACK  (TMemberCallback::*lpfnJournalPlaybackProc)
  79.                         (int, WPARAM, LPARAM);
  80.     LRESULT  CALLBACK  (TMemberCallback::*lpfnJournalRecordProc)
  81.                         (int, WPARAM, LPARAM);
  82.     LRESULT  CALLBACK  (TMemberCallback::*lpfnKeyboardProc)
  83.                         (int, WPARAM, LPARAM);
  84.     void     CALLBACK  (TMemberCallback::*lpfnLineDDAProc)
  85.                         (int, int, LPARAM);
  86.     HGLOBAL  CALLBACK  (TMemberCallback::*lpfnLoadProc)
  87.                         (HGLOBAL, HINSTANCE, HRSRC);
  88.     LRESULT  CALLBACK  (TMemberCallback::*lpfnMessageProc)
  89.                         (int, WPARAM, LPARAM);
  90.     LRESULT  CALLBACK  (TMemberCallback::*lpfnMouseProc)
  91.                         (int, WPARAM, LPARAM);
  92.     BOOL     CALLBACK  (TMemberCallback::*lpfnNotifyProc)
  93.                         (HGLOBAL);
  94.     LRESULT  CALLBACK  (TMemberCallback::*lpfnShellProc)
  95.                         (int, WPARAM, LPARAM);
  96.     LRESULT  CALLBACK  (TMemberCallback::*lpfnSysMsgProc)
  97.                         (int, WPARAM, LPARAM);
  98.     void     CALLBACK  (TMemberCallback::*lpfnTimerProc)
  99.                         (HWND, UINT, UINT, DWORD);
  100.     LRESULT  CALLBACK  (TMemberCallback::*lpfnWindowProc)
  101.                         (HWND, UINT, WPARAM, LPARAM);
  102.     int      CALLBACK  (TMemberCallback::*lpfnWordBreakProc)
  103.                         (LPSTR, int, int, int);
  104.  
  105.     FARPROC lpfn;
  106. };   
  107.  
  108. // These are the typedefs that are required to cast the derived class's member
  109. // functions into a member function type that TMemberCallback's class can
  110. // use.
  111. typedef BOOL     CALLBACK  (TMemberCallback::*LPFNABORTPROC)
  112.                             (HDC, int);
  113. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNCALLWNDPROC)
  114.                             (int, WPARAM, LPARAM);
  115. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNCBTPROC)
  116.                             (int, WPARAM, LPARAM);
  117. typedef HDDEDATA CALLBACK  (TMemberCallback::*LPFNDDECALLBACK)
  118.                             (UINT, UINT, HCONV, HSZ, HSZ,
  119.                              HDDEDATA, DWORD, DWORD);
  120. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNDEBUGPROC)
  121.                             (int, WPARAM, LPARAM);
  122. typedef BOOL     CALLBACK  (TMemberCallback::*LPFNDIALOGPROC)
  123.                             (HWND, UINT, WPARAM, LPARAM);
  124. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNDRIVERPROC)
  125.                             (DWORD, HDRVR, UINT, LPARAM, LPARAM);
  126. typedef BOOL     CALLBACK  (TMemberCallback::*LPFNENUMCHILDPROC)
  127.                             (HWND, LPARAM);
  128. typedef int      CALLBACK  (TMemberCallback::*LPFNENUMFONTFAMPROC)
  129.                             (LOGFONT FAR*, TEXTMETRIC FAR*, int, LPARAM);
  130. typedef int      CALLBACK  (TMemberCallback::*LPFNENUMFONTSPROC)
  131.                             (LOGFONT FAR*, NEWTEXTMETRIC FAR*, int, LPARAM);
  132. typedef int      CALLBACK  (TMemberCallback::*LPFNENUMMETAFILEPROC)
  133.                             (HDC, HANDLETABLE FAR*, METARECORD FAR*, int, 
  134.                              LPARAM);
  135. typedef int      CALLBACK  (TMemberCallback::*LPFNENUMOBJECTSPROC)
  136.                             (void FAR*, LPARAM);
  137. typedef BOOL     CALLBACK  (TMemberCallback::*LPFNENUMPROPFIXEDPROC)
  138.                             (HWND, LPCSTR, HANDLE);
  139. typedef BOOL     CALLBACK  (TMemberCallback::*LPFNENUMPROPMOVABLEPROC)
  140.                             (HWND, LPCSTR, HANDLE);
  141. typedef BOOL     CALLBACK  (TMemberCallback::*LPFNENUMTASKWNDPROC)
  142.                             (HWND, LPARAM);
  143. typedef BOOL     CALLBACK  (TMemberCallback::*LPFNENUMWINDOWSPROC)
  144.                             (HWND, LPARAM);
  145. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNGETMSGPROC)
  146.                             (int, WPARAM, LPARAM);
  147. typedef BOOL     CALLBACK  (TMemberCallback::*LPFNGRAYSTRINGPROC)
  148.                             (HDC, LPARAM, int);
  149. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNHARDWAREPROC)
  150.                             (int, WPARAM, LPARAM);
  151. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNJOURNALPLAYBACKPROC)
  152.                             (int, WPARAM, LPARAM);
  153. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNJOURNALRECORDPROC)
  154.                             (int, WPARAM, LPARAM);
  155. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNKEYBOARDPROC)
  156.                             (int, WPARAM, LPARAM);
  157. typedef void     CALLBACK  (TMemberCallback::*LPFNLINEDDAPROC)
  158.                             (int, int, LPARAM);
  159. typedef HGLOBAL  CALLBACK  (TMemberCallback::*LPFNLOADPROC)
  160.                             (HGLOBAL, HINSTANCE, HRSRC);
  161. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNMESSAGEPROC)
  162.                             (int, WPARAM, LPARAM);
  163. typedef LRESULT  CALLBACK  (TMemberCallback::*LPFNMOUSEPROC)
  164.                             (int, WPARAM, LPARAM);
  165. typedef BOOL     CALLBACK  (TMemberCallback::*LPFNNOTIFYPROC)
  166.                             (HGLOBAL);
  167.